<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>自定义动画animate</title>
    <script src="jquery.min.js"></script>
    <style>
        div{
            background: orange;
            position: absolute;
            width: 100px;
            height: 100px;
        }
    </style>
</head>
<body>
    <button>动起来</button>
    <div></div>

    <script>
        $(function(){
            $('button').click(function(){
                $('div').animate({
                    // animate函数必须写参数,多对参数直接用逗号隔开
                    left: 200,
                    top: 200,
                    opacity: 0.5,
                    width: 200
                },1500);
                // 表示动画效果的时间是1500ms
            });
        })
    </script>
</body>
</html>